<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>姑苏复工信息上报</title>
    <script src="../js/jquery.min.js"></script>
    <script src="../js/contants.js"></script>
    <script src="../js/YZidCard.js"></script>
    <link rel="stylesheet" href="../css/addcommon.css">
</head>
<body>
<div class="titlebox"></div>
<!--<div class="contentbox"></div>-->
<div class="infobox">
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
            <span class="title">姓名</span>
        </div>
        <div class="ipbox">
            <input id="name" placeholder="请输入员工姓名"/>
        </div>
    </div>
    <div class="line"></div>
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
            <span class="title">是否外籍</span>
        </div>
        <div class="ipbox">
            <select id="SFWJ">
                <option value="是">是</option>
                <option value="否">否</option>
            </select>
        </div>
    </div>
    <div class="line"></div>
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
            <span class="title">身份证号/护照</span>
        </div>
        <div class="ipbox">
            <input id="idcard" placeholder="请输入身份证号/护照"/>
        </div>
    </div>
    <div class="line"></div>
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
            <span class="title">手机号</span>
        </div>
        <div class="ipbox">
            <input id="phone" placeholder="请输入手机号"/>
        </div>
    </div>
    <div class="line"></div>
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
            <span class="title">户籍所在地</span>
        </div>
        <div class="ipbox">
            <input id="huji" placeholder="例：江苏省苏州市姑苏区"/>
        </div>
    </div>
    <div class="line"></div>
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
            <span class="title">苏州现住址</span>
        </div>
        <div class="ipbox">
            <input id="address" placeholder="请输入苏州现住址"/>
        </div>
    </div>
    <div class="line"></div>
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
            <span class="title">近14天是否离开苏州</span>
        </div>
        <div class="ipbox">
            <select id="sflikai" onchange="show(this.value)">
                <option value="">请选择</option>
                <option value="是">是</option>
                <option value="否">否</option>
            </select>
        </div>
    </div>
    <div class="line"></div>
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
            <span class="title">近14天是否到过或<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;途径以下地点</span>
        </div>
        <div class="ipbox">
            <select id="sfyujing">
                <option value="">请选择</option>
                <option value="是">是</option>
                <option value="否">否</option>
            </select>
        </div>
    </div>
    <span id="ts">(湖北全省各市；浙江省温州市；河南省信阳市；安徽省阜阳市)</span>
    <div class="line"></div>
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
            <span class="title">是否接触确诊或<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;疑似病例</span>
        </div>
        <div class="ipbox">
            <select id="sfjiechu">
                <option value="">请选择</option>
                <option value="是">是</option>
                <option value="否">否</option>
            </select>
        </div>
    </div>
    <div class="line"></div>
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
            <span class="title">是否接触野生动物</span>
        </div>
        <div class="ipbox">
            <select id="sfyeshen">
                <option value="">请选择</option>
                <option value="是">是</option>
                <option value="否">否</option>
            </select>
        </div>
    </div>
    <div class="line"></div>
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
            <span class="title">健康状况</span>
        </div>
        <div class="ipbox">
            <input id="jkzhuankuang" placeholder="有、无发热、咳嗽、乏力、腹泻等"/>
        </div>
    </div>
    <div class="line"></div>
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
            <span class="title">备注</span>
        </div>
        <div class="ipbox">
            <input id="beizhu" placeholder="离苏人员填写前往地点、交通工具"/>
        </div>
    </div>
    <div class="line"></div>
    <br><br><br>
    <div>
        <div class="btbox">
            <span class="tb">*</span>
           <span class="title" id="fjtit">附件上传</span>
        </div>
        <div class="ipbox">
            <input id="fujian" placeholder="运营商行动轨迹证明或社区出具的解除隔离证明" onclick="selectFile1()"/>
<!--            <button class="btn btn-primary" style="width:8%;display: inline-block;margin-top:1%;margin-left: 2%" onclick="selectFile1()">上传</button>-->
            <input type="file" name="excelFile" id="excelFile1" class="btn btn-default"  multiple="multiple" onchange="fileUpload1()" style="display: none">
        </div>
    </div>
    <div class="line"></div>
    <div id="ShangBao"></div>
</div>
<div class="tsbox"  id="tscon" style="display: none">
    <img src="gb.png" style="width:5%;position: relative;left:95%;" onclick="guanbi()"/>
    <span>一、移动用户查询方法</span><br>
    <span>编写CXMYD,发送到10086,再依据回复短信输入身份证后四位，可查询过去一个月内去过的省和直辖市(无地市)。</span><br>
    <span>二、电信手机用户查询方法</span><br>
    <span>编辑短信CXMYD#每人免费一天查询10次。身份证号码后四位到10001，授权回复Y后，实现“漫游地查询"，可查询手机号近15日内的途径地信息。</span><br>
    <span>三、联通手机用户查询方法</span><br>
    <span>手机发送:“CXMYD#身份证后四位”至10010，查询近30天的全国漫游地信息，便于返工辅助排查。</span><br>
    <span>每人免费一天查询10次。</span>
</div>
</body>
<script>
    function GetRequest() {
        var urlStr = location.search
        if (typeof urlStr == "undefined") {
            var url = location.search; //获取url中"?"符后的字符串
        } else {
            var url = "?" + urlStr.split("?")[1];
        }
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for (var i = 0; i < strs.length; i++) {
                theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
            }
        }
        return theRequest;
    }
    var parms = GetRequest()
    var qyid = parms['qyid']
    if(qyid==null||qyid==""){
        alert('该二维码信息不对，请重新生成。')
    }
   // var qyid='fe50b4e2ec1a4814b1aafb4bb0723fd3';
    // $("#name").on("change",function(){
    //     var ygname = $("#name").val()
    //     if(ygname==''){
    //         document.getElementById('JGWord').style.display=''
    //     }else{
    //         document.getElementById('JGWord').style.display='none'
    //     }
    // })
    $("#SFWJ").val('否');
    function show(a){
        if(a == '是'){
            $("#fjtit").html('证明材料上传 ')
            $('#fujian').attr('placeholder','社区出具的解除隔离证明')
        }else{
            $("#fjtit").html('<a href="#" onclick="ts()">证明材料上传</a>')
            $('#fujian').attr('placeholder','15天内行动轨迹查询结果(截图)')
        }
    }
    function ts(){
        console.log(':aaa');
        document.getElementById('tscon').style.display=""
    }
    function guanbi(){
        document.getElementById('tscon').style.display="none"
    }
    $("#ShangBao").unbind('click').click(function () {
        var sfwaiji = $("#SFWJ").val()
        var sfzjy = IdentityCodeValid($("#idcard").val())
        var head=$("#idcard").val().substring(0,4);
        var head1=$("#idcard").val().substring(0,2);
        if ($("#name").val() == '' || $("#idcard").val() == '' ||$("#phone").val() == ''
            ||$("#huji").val() == '' ||$("#address").val() == '' ||$("#sflikai").val() == '' ||
            $("#sfyujing").val() == '' ||$("#sfjiechu").val() == '' ||$("#sfyeshen").val() == '' ||$("#jkzhuankuang").val() == ''||$("#fgshijian").val() == '') {
            alert("请将除备注外的信息填写完整！")
        }else if ($("#sflikai").val() == '是' && !$("#beizhu").val()) {
            alert("近14天离开苏州的人员请在备注中将前往地址、交通工具填写完整！")
        }else if(sfwaiji=='否'&&sfzjy=='false'){
            alert("身份证/护照信息不正确，请重新输入!")
        }else if(head1=='42'||head=='3303'||head=='3301'||head=='3302'||head=='3310'||head=='4115'||head=='4117'||head=='3401'||head=='3412'||head=='3601'){
            if($("#fujian").val()==""){
                alert("属于重点疫区人员必须上传附件!")
            }else {
                add()
            }
        } else{
            add()
        }

    })
    function add(){
        var obj = {
            'name': $("#name").val(),

            'idcard': $("#idcard").val(),
            'phone': $("#phone").val(),
            'sfwaiji': $("#SFWJ").val(),
            'huji': $("#huji").val(),
            'address': $("#address").val(),

            'sflikai': $("#sflikai").val(),
            'sfyujing': $("#sfyujing").val(),

            'sfjiechu': $("#sfjiechu").val(),
            'sfyeshen': $("#sfyeshen").val(),

            'jkzhuankuang': $("#jkzhuankuang").val(),
            'beizhu': $("#beizhu").val(),
            'fujian': $("#fujian").val(),
            'fgshijian': $("#fgshijian").val(),
            'qyid': qyid,
        };
        $.ajax({
            url:svcHeader+"pv/ryxxs",
            dataType:'json',
            type:'POST',
            contentType: 'application/json',
            data:JSON.stringify(obj),
            success:function (data) {
                if(data.code=="200"){
                    alert("新增成功！")
                    $("#myModal1").modal('hide');
                    $("#table").bootstrapTable('destroy');
                    var oTable = new TableInit();
                    oTable.Init();
                }else{
                    alert(data.msg)
                }
            }
        })
    }
    function selectFile1(){
        $("#excelFile1").trigger("click");
    }
    function fileUpload1() {
        var file=document.getElementById("excelFile1");
        var fileObj = file.files[0];
        var formdata = new FormData();
        formdata.append('multipartFile',fileObj);
        //console.log(formdata)
        $.ajax({
            url: svcHeader + "SaveSource",//这里写你的url
            type: 'POST',
            data:formdata,
            processData:false,
            contentType:false,
            success: function (data) {
                if(data.code=="200"){
                    alert("上传成功！")
                    $("#fujian").val(data.data[0])
                }else{
                    alert(data.msg)
                }
            },
            error: function (data) {
                alert("页面请求失败！");
            }
        })
    }
</script>
</html>